package com.service.utility.jwt;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;

/**
 * JWT Payload
 * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32
 * https://jwt.io
 * https://github.com/auth0/java-jwt
 *
 */
@Setter
@Getter
@ToString
public class JWTPayload {

    //***************************** JWT标准字段 ****************************/

    /**
     * 签发者 issuer
     */
    private String iss;

    /**
     * 签发时间(时间戳) issued at
     */
    private Date iat;

    /**
     * 过期时间(时间戳) expire
     * 为防止Replay Attacks, 过期时间应该设置的比较短，比如exp = iat + 2(s)
     */
    private Date exp;

    /**
     * not before(时间戳)
     * 如果当前时间在nbf里的时间之前，则Token不被接受
     */
    private Date nbf;

    /**
     * JWT ID
     * 当前token的唯一标识, 使用UUID
     */
    private String jti;

    /**
     * 接收方 Audience
     */
    private String[] aud;

    /**
     * 面向的用户 Subject
     */
    private String sub;

    //***************************** 自定义字段 ****************************/

    private Integer userId;

    private Integer pid;

    private Integer gid;

    private Integer ggid;

    private String account;

    private String mobile;

    private String username;

    private String email;


    //------------******---------

    private String sessionId;
}
